package com.longdaji.decoration.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.longdaji.decoration.R;

public class SignInDialog extends Dialog {

    private Callback mCallBack;
    private Context mContext;
    private Button mBtnSubmit;

    public SignInDialog(Context context) {
        //重点实现R.style.DialogStyle 动画效果
        this(context, R.style.CommonDialog);
        mContext = context;

    }

    public SignInDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    public void setData(Callback callback) {
        this.mCallBack = callback;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_sign_in);
        initView();
    }

    private void initView() {

        mBtnSubmit = findViewById(R.id.btn_submit);
        mBtnSubmit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mCallBack.onSubmit();
                dismiss();
            }
        });
    }

    public interface Callback {
        void onSubmit();

        void onCancle();
    }
}
